import java.util.Scanner;
public class GuessNumber {
    public static void main(String[] args) {
        while (true){
            int answer=(int)(Math.random()*100)+1;
            Scanner scann =new Scanner(System.in);
            int times=0;
            int guess=0;
            while (times<7){
                System.out.println("请输入1-100之间安定数字");
                guess=scann.nextInt();
                times=times+1;

                if (guess<answer){
                    System.out.println("小了");
                }else if (guess>answer){
                    System.out.println("大了");
                }else {
                    System.out.println("恭喜你才对了");
                    break;
                }
            }
            if (times==7&&times!=guess){
                System.out.println("可惜！次数用完了");
            }
            System.out.println("再来一句吗（y/n）");
            String choice =scann.next();
            if (!choice.equalsIgnoreCase("y")){
                break;
            }
        }


    }

}
